﻿package widget.common.tools
{
	import flash.display.Bitmap;
	import flash.display.Loader;
	import flash.events.Event;
	
	import widget.common.event.LoadDataEvent;
	
	public class PictureLoader extends DisplayLoader
	{
		public function PictureLoader()
		{
			super();
		}

		override protected function completeHandler(event : Event) : void
		{
			super.completeHandler(event);
			var load : Loader = Loader(event.currentTarget.loader);
			// var byteArray:ByteArray = load.contentLoaderInfo.bytes;
			// byteArray.position = 0;
			var bitmap : Bitmap = load.content as Bitmap;
			this.dispatchEvent(new LoadDataEvent(LoadDataEvent.COMPLETE_LOADER , bitmap));
		}

		override public function loadByURL(url : String) : void
		{
			this.loadURL = url;
			load();
		}

		override public function clear() : void
		{
			super.clear();
		}
	}
}